<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>生命周期</h1>
    <div id="app">
        <h2>{{msg}}</h2>
    </div>
</body>
<script src="https://cn.vuejs.org/js/vue.js"></script>
<script>
    /* 
        生命周期
            * Vue实例从创建到销毁的过程

     */
    let vm = new Vue({
        el:"#app",
        data:{
            msg:"hello tiantian"
        },
        // 声明周期函数   钩子函数
        beforeCreate(){
            console.log("beforeCreate==================>");
            console.log("el",this.$el);
            console.log("data",this.$data);
        },
        created () {
            console.log("created==================>");
            console.log("el",this.$el);
            console.log("data",this.$data);
        },
        // 挂载
        beforeMount (){
            console.log("beforeMount==================>");
            console.log("el",this.$el);
            console.log("data",this.$data);
        },
        // 挂载成功
        mounted(){
            console.log("mounted==================>");
            console.log("el",this.$el);
            console.log("data",this.$data);
        },
        // 更新数据前
        beforeUpdate () {
            console.log("beforeUpdate==================>");
            console.log("el",this.$el);
            console.log("data",this.$data);
        },
        // 更新数据后
        Update () {
            console.log("Update==================>");
            console.log("el",this.$el);
            console.log("data",this.$data);
        },
        // 销毁前
        beforeDestroy () {
            console.log("beforeDestroy==================>");
            console.log("el",this.$el);
            console.log("data",this.$data);
        },
        // 销毁后
        destroy () {
            console.log("destroy==================>");
            console.log("el",this.$el);
            console.log("data",this.$data);
        },

    })


</script>
</html>